<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * confirm.php
 * @author ranuandra
 *
 * 3 Mei 2012 09:22:00
 *
 * 
 */
?>
          <div class="toolbar-wrapper">
            	<div class="toolbar-container">

                </div>
            	<h1 class="title"><?php echo $datas[0]->mstlowongan->deskripsi?></h1>
            </div>
            <p>Silahkan konfirmasi daftar pelamar yang akan diproses di bawah ini, atau <a href="<?php echo URL::base() ?>admin/pelamar/lowongan/<?php echo $datas[0]->mstlowongan_id ?>">klik disini</a> untuk kembali ke daftar</p>
            <div class="form-container">
            <?php 
            echo Form::open(URL::base().'admin/pelamar/proses');
            echo Form::hidden('mstlowongan_id', $id, array()); 
            foreach($datas as $data)
            {
            	echo Form::hidden('pelamarlowongan_id[]', $data->id, array());
            }           
            ?>
                
	                  <fieldset>
	                      <legend>Data Tahapan Proses</legend>
	                      <div><label for="uname">Proses Lamaran<em>*</em></label> 
	                          	<?php echo Form::select('mstproses_id', $proseses, '', array())?>
                          </div>
                          <div><label for="uname">Alamat Proses<em>*</em></label> 
                          		<?php echo Form::input('alamat', '', array())?>
                          </div>	  
                          <div><label for="uname">Pic<em>*</em></label> 
                          		<?php echo Form::input('pic', '', array())?>
                          </div>	
                          <div><label for="uname">Tanggal<em>*</em></label> 
                          
                          		<?php echo Form::input('tgl', '', array('id' => 'prosesdate'))?>
                          </div>	     
                  	       <div><label for="uname">Jam<em>*</em></label> 
                          		<?php echo Form::input('jam', '', array('id' => 'jam'))?>
                          </div>	                                            
                  </fieldset>
                  
             
            <div class="content">
           		<table class="data">
                	<thead>
                    	<tr>
                        	<th>Nama, Tgl Apply </th>
                        	<th>Lates Position</th>
                        	<th>Pnglmn</th>
                        	<th>Top Skill</th>
                        	<th>Pendidikan, IPK</th>
                        	<th>Umur</th>
                        	<th>Domisili</th>
                        </tr>
                    </thead>
                   <tbody>
                    <?php 
                    if(isset($datas))
                    {
                    	foreach($datas as $data)
                    	{
                    		
                    ?>
                    	<tr>
                        	
                            <td align="center">
                            
                            <a href="<? echo URL::base() ?>admin/pelamar/detail/<?php echo $data->id?>" id="fancy">
                           	 	<?php echo $data->mstpelamar->nama_lengkap?><br />                           
                    			<?php echo $data->kode_lamaran?></a><br />
                    			<?php 
                    			if($data->flag_read == 0)
                    			{
                    				echo "Unread";	
                    			}
                    			else 
                    			{
                    				echo "Read";
                    			}
                    			
                    			echo "<br />".date("d M y", strtotime($data->tgl_apply));
                    			?>
                            
                            </td>
                            <td>
                            <?php 
                            	$pengalaman = $data->mstpelamar->pelamarpengalaman->order_by('sampai_tanggal', 'DESC')->find();
                            	if($pengalaman != null)
                            	{
                            		echo $pengalaman->mstposisi->posisi."<br />";
                            		echo $pengalaman->institusi."<br />";
                            		echo $pengalaman->mstbidang->bidang."<br />";
                            		echo $pengalaman->gaji;
                            	}
                            ?>
                            </td>
                            <td>
                              <?php 
                                if($pengalaman != null)
                            	{
                            		$d1 = (is_string($pengalaman->sampai_tanggal) ? strtotime($pengalaman->sampai_tanggal) : $pengalaman->sampai_tanggal);
								    $d2 = (is_string($pengalaman->dari_tanggal) ? strtotime($pengalaman->dari_tanggal) : $pengalaman->dari_tanggal);  
								    $diff_secs = abs($d1 - $d2);
                            		
                            		echo floor($diff_secs / (3600 * 24 * 365.25));
                            	}
                            ?>                          
                            </td>
                            <td>
                            <?php 
                                if($pengalaman != null)
                            	{
                            		echo $pengalaman->mstspesialisasi->spesialisasi."<br />";
                            	}
                            ?>
                            </td>
                            <td>
    						<?php 
    							$pendidikan = $data->mstpelamar->pelamarpendidikan->order_by('thn_lulus', 'DESC')->find();
    							if($pendidikan != null)
    							{
    								echo $pendidikan->mstjurusan->jurusan."<br/>";	
    								echo $pendidikan->institusi."<br/>";
    								echo $pendidikan->ipk."<br/>";
    							}
    							
    						?>
                            </td>
                            <td>
                            <?php
                            		$d1 = (is_string($data->mstpelamar->tgl_lahir) ? strtotime($data->mstpelamar->tgl_lahir) : $data->mstpelamar->tgl_lahir);
								    $d2 = (is_string(date("Y-m-d")) ? strtotime(date("Y-m-d")) : date("Y-m-d"));  
								    $diff_secs = abs($d2 - $d1);
                            		
                            		echo floor($diff_secs / (3600 * 24 * 365.25));							
                            //echo $data->mstpelamar->tgl_lahir
                            ?>                            
                            </td>
                            <td>
                            <?php 
                            	echo $data->mstpelamar->kota_ktp."<br/>";
                            ?>
                            </td>
                        </tr>
                    <?php 
                    	}
                    }
                    ?>
                    </tbody>
                    <tfoot>
                    	<tr>
                        	<td></td>
                            <td></td>
                        	<td></td>
                        	<td></td>
                            <td></td>
                            <td></td>
                        	<td>
                        	<?php 
                        		echo Form::submit('submit', 'Proses', array());
                        	?>
                        	</td>
                        </tr>                    
                    </tfoot>
                </table>
            
            <?php 
	            
	            echo Form::close();
	            $tgl = strtotime(date("Y-m-d", strtotime($lowongan->dateto)). " +1 day");
	            
            ?>
            </div>
            </div>
<script type="text/javascript">
	$(document).ready(function() {
		$('#prosesdate').datepicker({
			dateFormat: "yy-mm-dd",
			minDate: "<?php echo date("Y-m-d", $tgl) ?>"

		});
	})
</script> 